import { EntityModel } from '@midwayjs/orm';
import { Column, OneToMany } from 'typeorm';
import { BaseModel } from '../utils/base.model';
import { Attachment } from './Attachment';

export enum ConvenientType {
  // 临时救助
  LSJZ = 'lsjz',
  // 二孩生育
  EHSY = 'ehsy',
}

@EntityModel()
export class ConvenientService extends BaseModel {
  @Column({
    comment: '业务类型',
    type: 'enum',
    enum: ConvenientType,
  })
  type: ConvenientType;

  @Column({
    comment: '提交时间',
    nullable: true,
  })
  commitTime: Date;

  @Column({
    comment: '结束时间',
    nullable: true,
  })
  finishTime: Date;

  @Column({
    comment: '提交人',
    nullable: true,
  })
  commitPeople: string;

  @OneToMany(() => Attachment, attachment => attachment.convenient)
  attachments: Attachment[];
}
